package
import com.docu.common.Action
import com.docu.common.Message
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

@Component("update${className}Action")
class Update${className}Action extends Action {
  @Autowired
  ${className}Service ${propertyName}Service

   public Object preCondition(Object params, Object object) {
    ${className} ${propertyName} = ${className}.read(Long.parseLong(params?.id?.toString()))
    ${propertyName}.properties=params
    if (!${propertyName}.validate()) {
      return null
    }
    return ${propertyName}
  }

   public Object postCondition(Object params, Object object) {
    //not implement
    return null
  }

   public Object execute(Object params, Object object) {
    try {
      return ${propertyName}Service.update(object)
    } catch (Exception ex) {
      log.error(ex.message)
      return null
    }
  }
}
